﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ChatForum.Client
{
    public partial class BasePage : System.Web.UI.Page
    {
        [System.Web.Services.WebMethod]
        public static string[] GetDistinctPingingUser()
        {
            if (HttpContext.Current.Application["ChatData"] != null)
            {
                List<PingData> allPingData = (List<PingData>)HttpContext.Current.Application["ChatData"];
                if (HttpContext.Current.User != null && HttpContext.Current.User.Identity != null)
                {
                    var v = allPingData.Where(pd => pd.TargetUser == HttpContext.Current.User.Identity.Name).Select(pd => pd.SourceUser).ToArray();
                    return v;
                }
                return null;
            }
            return null;
        }
    }
}